home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include "gl.h"
- #include "geom.h"
- #include "selectors.h"
- #include "class.h"
- #include "classIds.h"
- #include "mbox.h"
- #include "individual.h"
- #include "behavior.h"
- #include "doers.h"
- #include "bub.h"
-
- #include "colors.h"
-
- extern class indivClass;
- model bubbleModel;
- model wigglerBubModel;
- model feederBubModel;
- model colorBubModel;
- model femaleBubModel;
- model maleBubModel;
-
- extern behavior wigglerTemplate;
- extern behavior colorizerTemplate;
- extern behavior feederTemplate;
- extern behavior femaleTemplate;
- extern behavior maleTemplate;
-
- extern char *bubbleinit();
- extern char *bubblefree();
- extern char *selectBub();
-
- fcnTable bubbleTable[] = {
- INIT, bubbleinit, /* build bubble drawing */
- FREE, bubblefree,
- SELECT, selectBub, /* post the behavior held by picked bubble */
- POSTBEHAVE, NULL, /* should never be posted of a behavior */
- EOTABLE,
- };
-
- class bubbleClass = {
- &indivClass,
- bubbleTable,
- sizeof(bubble),
- BUBBLE,
- };
-
- bubble bubbleTemplate = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &bubbleModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- /* bubble */
- NULL, /* doer */
- };
-
- model bubbleModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- BUBBLE_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- bubble wigglerBub = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &wigglerBubModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubble */
- &wigglerTemplate, /* doer */
- };
-
- model wigglerBubModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- WIGGLER_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- bubble feederBub = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &feederBubModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubble */
- &feederTemplate, /* doer */
- };
-
- model feederBubModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- FEEDER_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- bubble colorizerBub = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &colorBubModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubble */
- &colorizerTemplate, /* doer */
- };
-
- model colorBubModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- COLORIZER_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- bubble femaleBub = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &femaleBubModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubble */
- &femaleTemplate, /* doer */
- };
-
- model femaleBubModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- FEMALE_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- bubble maleBub = {
- /* inst */
- &bubbleClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,300}, /* velocity */
- {0,0,300}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &maleBubModel, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubble */
- &maleTemplate, /* doer */
- };
-
- model maleBubModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- NULL, /* point dictionary */
- NULL, /* polygon descriptions */
- {0 ,0, 0}, /* centroid */
- MALE_COLOR, /* color */
- BUBBLE_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 20, /* declasse */
- };
-
- extern char *blowInit();
- extern char *blowBubble();
- extern behavior *doerbubs[];
-
- fcnTable bubbleMachineTable[] = {
- INIT, blowInit,
- DOIT, blowBubble,
- EOTABLE,
- };
-
- class bubbleMachineClass = {
- &indivClass,
- bubbleMachineTable,
- sizeof(bubbleMachine),
- BUBBLEMACHINE,
- };
-
- bubbleMachine bubbleMachineTemplate = {
- /* inst */
- &bubbleMachineClass,/* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {500,100,-5000}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,0}, /* velocity */
- {0,0,0}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- NULL, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* bubbleMachine */
- 0, /* bubbleClock */
- 5, /* bubbleDispatchIncr */
- 3, /* bubbleSpeedupIncr */
- 0, /* bubbleDoer */
- doerbubs, /* doers */
- };
-
- behavior *doerbubs[] = {
- &feederTemplate,
- &colorizerTemplate,
- &femaleTemplate,
- &maleTemplate,
- &wigglerTemplate,
- NULL,
- };
-